package com.mercury.tests;
import java.util.List;

import org.hibernate.*;

import com.mercury.beans.*;

public class Test4 {
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		Session session = HibernateUtil.currentSession();
		
		Transaction tx = session.beginTransaction();
		session.save(new LocalUser("Tracy","NewYork"));
		session.save(new RemoteUser("Bob","Canada"));
		tx.commit();
		
		String hql ="from User2";
		//String hql ="from java.lang.objects";
		List<User2> list = session.createQuery(hql).list();
		for(User2 p:list){
			System.out.println(p);
		}
		HibernateUtil.closeSession();
	}
}
	

